#include "StdAfx.h"
#include ".\zonefactory.h"
#include "Village.h"
#include "BattleZone.h"
#include <assert.h>

ZoneFactory::ZoneFactory(void)
{
	m_pZonePool = NULL;
}

ZoneFactory::~ZoneFactory(void)
{
	assert( m_pZonePool == NULL );
}

VOID ZoneFactory::Init()
{
	m_pZonePool			= new CMemoryPoolFactory<Zone>;
	m_pZonePool->Initialize( 1500, 100 );
}

VOID ZoneFactory::Release()
{
	SAFE_DELETE( m_pZonePool );
}

Zone* ZoneFactory::AllocZone()
{
	Zone *pZone = m_pZonePool->Alloc();
	pZone->Init();

	return pZone;
}

VOID ZoneFactory::FreeZone( Zone *pZone )
{
	pZone->Release();

	m_pZonePool->Free( pZone );
}